]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
network: don't assume NMActiveConnection has a device
authorWill Thompson <will@willthompson.co.uk>
Fri, 21 Jun 2019 09:47:40 +0000 (10:47 +0100)
committerWill Thompson <will@willthompson.co.uk>
Fri, 21 Jun 2019 10:26:53 +0000 (11:26 +0100)
In practice this has been seen to fail:

    JS ERROR: TypeError: active.get_devices(...)[0] is undefined
    ensureActiveConnectionProps@resource:///org/gnome/shell/ui/status/network.js:73:22
    _getMainConnection@resource:///org/gnome/shell/ui/status/network.js:1791:13
    _syncMainConnection@resource:///org/gnome/shell/ui/status/network.js:1809:32

https://gitlab.gnome.org/GNOME/gnome-shell/issues/1406

js/ui/status/network.js

index 4ab82e9f298b81c47e1645414be605423c224e2f..7c2499d0eda69830f65d148cb4798e5ffaf854ad 100644 (file)
@@ -69,9 +69,12 @@ function ssidToLabel(ssid) {
 
 function ensureActiveConnectionProps(active, client) {
     if (!active._primaryDevice) {
-        // This list is guaranteed to have only one device in it.
-        let device = active.get_devices()[0]._delegate;
-        active._primaryDevice = device;
+        let devices = active.get_devices();
+        if (devices.length > 0) {
+            // This list is guaranteed to have at most one device in it.
+            let device = devices[0]._delegate;
+            active._primaryDevice = device;
+        }
     }
 }